get: str = input().strip().split(",")
res = map(int, get)
use_for = list(res)

x_, y_ = use_for[0] - 1, use_for[1] - 1
tmp_1 = []
for i in range(0, use_for[0]):
    tmp_2 = []
    for j in range(0, use_for[1]):
        tmp_2.append(0)
    tmp_1.append(tmp_2)
# 病毒位置
x, y = use_for[2], use_for[3]
j, k = use_for[4], use_for[5]

tmp_1[x][y] = 1
tmp_1[j][k] = 1


def set(tmp_1, x, y):
    if x == 0 and y == 0:
        tmp_1[x + 1][y] = 1
        tmp_1[x][y + 1] = 1
    elif x == 0 and y == y_:
        tmp_1[x + 1][y] = 1
        tmp_1[x][y - 1] = 1
    elif y == 0 and x == x_:
        tmp_1[x - 1][y] = 1
        tmp_1[x][y + 1] = 1
    elif y == y_ and x == x_:
        tmp_1[x - 1][y] = 1
        tmp_1[x][y - 1] = 1
    elif x == 0:
        tmp_1[x + 1][y] = 1
        tmp_1[x][y - 1] = 1
        tmp_1[x][y + 1] = 1
    elif x == x_:
        tmp_1[x - 1][y] = 1
        tmp_1[x][y - 1] = 1
        tmp_1[x][y + 1] = 1
    elif y == 0:
        tmp_1[x - 1][y] = 1
        tmp_1[x + 1][y] = 1
        tmp_1[x][y + 1] = 1
    elif y == y_:
        tmp_1[x - 1][y] = 1
        tmp_1[x + 1][y] = 1
        tmp_1[x][y - 1] = 1
    else:
        tmp_1[x - 1][y] = 1
        tmp_1[x + 1][y] = 1
        tmp_1[x][y - 1] = 1
        tmp_1[x][y + 1] = 1
    return tmp_1


def see(tmp_1):
    count = 0
    for i in tmp_1:
        for _ in i:
            if _ == 0:
                count += 1
    return count


def set_two(tmp_1, x, y):
    count_sec = 0
    get_1 = set(tmp_1, x, y)
    count_sec += 1
    if see(get_1) == 0:
        return count_sec
    else:
        for i in range(0, len(tmp_1)):
            for j in range(0, len(i)):
                if j == 1:
                    set_tmp = set(tmp_1, i, j)



print(tmp_1, x, y, j, k)
set_two(tmp_1, x, y, j, k)
